<template>
  <el-form ref="form" :rules="rules" :model="formEvent.form" label-width="120px" :size="size">
    <el-row :gutter="16">
      <!-- 通过调整lg的大�?  12 24/3=12 会变为一�?3�? -->
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="设备名称" prop="sbmc">
          <el-input v-model="formEvent.form.sbmc"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="运行状态" prop="yxzt">
          <!-- 10-未投运
20-在运
30-退役
40-报废 -->
          <el-select v-model="formEvent.form.yxzt">
            <el-option
              v-for="item in OptionData.OptionData_yxzt"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="计量方式" prop="jlfs">
          <el-input v-model="formEvent.form.jlfs"></el-input>
        </el-form-item>
      </el-col>
      <!-- 0否1是 -->
      <!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="是否删除">

          <el-input v-model="formEvent.form.sfsc"></el-input>
        </el-form-item>
      </el-col> -->
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="容量" prop="cap">
          <el-input v-model="formEvent.form.cap"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="设备类型编码  " prop="sblx">
          <el-input v-model="formEvent.form.sblx"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="设备类型名称" prop="sblxmc">
          <!-- <el-input v-model="formEvent.form.sblxmc"></el-input> -->
          <el-select v-model="formEvent.form.sblxmc" style="width:530px;">
            <el-option
              v-for="item in OptionData.OptionData_sblxmc"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="数量" prop="num">
          <el-input v-model="formEvent.form.num"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="规格" prop="standard">
          <el-input v-model="formEvent.form.standard"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="型号" prop="xh">
          <el-input v-model="formEvent.form.xh"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="厂家名称" prop="cjmc">
          <el-input v-model="formEvent.form.cjmc"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="出厂编码" prop="ccbm">
          <el-input v-model="formEvent.form.ccbm"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="出场日期" prop="ccTime">
          <el-input v-model="formEvent.form.ccTime"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="实际到货日期" prop="sjdhTime">
          <el-input v-model="formEvent.form.sjdhTime"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="产业单位名称" prop="cyDwmc">
          <el-input v-model="formEvent.form.cyDwmc"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="项目联系人" prop="xmlxr">
          <el-input v-model="formEvent.form.xmlxr"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="项目名称" prop="xmmc">
          <el-input v-model="formEvent.form.xmmc"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="项目编号" prop="xmbh">
          <el-input v-model="formEvent.form.xmbh"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="租赁期限" prop="zlqx">
          <el-input v-model="formEvent.form.zlqx"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="预计撤场时间" prop="yjccTime">
          <el-input v-model="formEvent.form.yjccTime"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="项目地址" prop="xmdz">
          <el-input v-model="formEvent.form.xmdz"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="联系人电话" prop="lxrPhone">
          <el-input v-model="formEvent.form.lxrPhone"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="联络时间" prop="lxTime">
          <el-input v-model="formEvent.form.lxTime"></el-input>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="单据回收状态" prop="djhszt">
          <!-- 0未回收 1 已回收 -->
          <!-- <el-input v-model="formEvent.form.djhszt"></el-input> -->
          <el-select v-model="formEvent.form.djhszt">
            <el-option
              v-for="item in OptionData.OptionData_djhszt"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
        <el-form-item label="产业单位编码" prop="cyDwbm">
          <el-input v-model="formEvent.form.cyDwbm"></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <!-- 主键是不可以编辑的，不可查看�? -->
    <el-input v-model="formEvent.form.sbbm" v-show="false"></el-input>
    <el-row :gutter="10">
      <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
        <el-form-item class="tool-button-container">
          <el-button
            @click="closeEvent()"
            :size="size"
            icon="fa fa-minus-square-o"
          >
            取消
          </el-button
          >
          <el-button
            type="primary"
            @click="submitEvent()"
            :size="size"
            icon="fa fa-save (alias)"
          >
            确定
          </el-button
          >
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
</template>

<script>
import {FormEvent} from "../model/tBizcEneryEquip-form.js";
// import { formModel, GridEvent } from '../model/tBizcEneryEquip-table'
import {reactive} from "vue";

export default {
  name: "tBizcEneryEquipForm",
  props: {
    formData: {
      type: Object,
    },
  },
  data() {
    return {
      size: "small",
      formEvent: reactive(FormEvent),
      // rules:reactive(FormEvent).rules,
      rules: {
        sbmc: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        yxzt: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        jlfs: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        cap: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        sblx: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        sblxmc: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        num: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        standard: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        xh: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        cjmc: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        xmlxr: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        xmmc: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        xmbh: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        zlqx: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        yjccTime: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        xmdz: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        lxrPhone: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        lxTime: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        djhszt: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ],
        cyDwbm: [
          {required: true, message: '不能为空', trigger: 'blur'},
        ]
      },
      // OptionData:formEvent.OptionData
      OptionData: {
        OptionData_yxzt: [],
        OptionData_sblxmc: [],
        OptionData_djhszt: [],
      },
    };
  },
  mounted() {
    this.formEvent.initFormData(this.formData);
  },
  methods: {
    closeEvent() {
      //关闭窗口事件,不刷�?//
      this.$emit("closeEvent", false);
    },
    submitEvent() {
      //关闭窗口事件,刷新表格数据//
      this.formEvent
        .saveFormData()
        .then((res) => {
          this.$emit("closeEvent", true);
          this.$message.success("保存成功!");
        })
        .catch((err) => {
          console.error(err);
        });
    },
  },
};
</script>

<style scoped>
.tool-button-container {
  text-align: right;
}

.el-select {
  width: 100% !important
}
</style>
